package com.feifan.provider.rabbitmq;

import com.feifan.api.service.IOmsOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @program: FinalProject
 * @author: Xiaofan
 * @createTime: 2021-08-11 15:50
 * @description: Functions of this class is
 **/
@Component
@RabbitListener(queues = "mall.order.cancel")
public class CancelOrderReceiver {
    private static Logger logger= LoggerFactory.getLogger(CancelOrderSender.class);

    @Autowired
    private IOmsOrderService service;//不需要用referrence 因为在一个模块下

    @RabbitHandler
    public void Handler(Long orderId){
        service.cancelOrder(orderId);
    }

}